<style type="text/css" rel="stylesheet">
    form {
    margin: 0;
    }
    .editor {
    margin-top: 5px;
    margin-bottom: 5px;
    }
    .ke-content {
    font-family: Courier New;
    font-size: 12px;
    background-color: #ffffff;
  }
  </style>
  <script type="text/javascript" charset="utf-8" src="/kindeditor/kindeditor.js"></script>
  <script type="text/javascript">
    KE.show({
        id : 'content_content',
        resizeMode :1,
        cssPath : '/kindeditor/index.css',
        items : [
        'undo', 'redo', 'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
        'removeformat', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
        'insertunorderedlist']
    });
  </script>
<script type="text/javascript" src="/javascripts/prototype.js"></script>
<link type="text/css" rel='stylesheet' href="/stylesheets/xtree.css" />
<script>
</script>
  </head>
<body>
 <!--目录下的 子目录和文章列表 暂时隐藏.......2009.8.24 16:00-->
   <div id="render">
      <%= render :partial => "flash" , :conllections => "@flashes" %><br />
    </div>
  
    <div id="operation">
       <a href="javascript:;" onclick="Element.hide('updateDiv'); Element.hide('channelDiv'); Element.hide('dirDiv'); Element.show('artDiv');">
       添加Flash</a> &nbsp;
       <a href="javascript:;" onclick="Element.hide('updateDiv'); Element.hide('channelDiv');Element.hide('artDiv'); Element.show('dirDiv');">
       增加子目录</a> &nbsp;
       <a href="javascript:;" onclick="Element.show('updateDiv'); Element.hide('channelDiv');Element.hide('artDiv'); Element.hide('dirDiv');">
       修改目录</a> &nbsp;
       <a href="javascript:;" onclick="Element.show('channelDiv'); Element.hide('updateDiv'); Element.hide('artDiv'); Element.hide('dirDiv');">
       频道管理</a> &nbsp;
     </div>
     <br/>  
     <!--频道管理-->
     <div id="channelDiv" style="display:none" >
              <table class="datalist">
                  <tr>
                    <th scope="col" width="150px">名称</th><th scope="col" width="200px">题标</th>
                    <th colspan="3" scope="col" width="320px"></th>
                  </tr>
                    <% i = 0   
                    Channel.find(:all).each do |c| %>
                    <% if i%2 == 0 %>
                  <tr>  <% else %> <tr  class="altrow"> <% end %>
                    <td><%=h c.name %></td><td><%=h c.title %></td>
                    <td><a href="javascript:;" onclick="Element.show('updateChannelDiv'); Element.hide('addChannelDiv');">
                    修改</a></td>
                    <td><%= link_to '删除', {:id => c, :action => :destroy_channel}, :confirm => '确定删除?'  %></td>
                  </tr><%  i += 1  
                  end  %>
                </table>
                <a href="javascript:;" onclick="Element.show('addChannelDiv'); Element.hide('updateChannelDiv');">增加</a>
                <!--修改频道-->
                <div id="updateChannelDiv" style="display:none">
                   <br /><br />
                   <form action="/content_manage/update_channel" method="post">
                     <%= tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, 
                         :value => form_authenticity_token) %> 
                         <input type="hidden" name="c_id" class="required"  value="<%=@content.id%>"/>
                      名称：<input type="text" name="channel[name]" value="名称"/> &nbsp;&nbsp;
                      标题：<input type="text" name="channel[title]" value="标题"/>
                        <input type="submit" name="submit]" value="修改" />
                   </form>
                </div>
                <!--增加一个频道-->
                <div id="addChannelDiv" style="display:none">
                <br /><br />
                 <form action="/content_manage/create_channel" method="post">
                   <%= tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, 
                       :value => form_authenticity_token) %> 
                       <input type="hidden" name="c_id" value="<%=@content.id%>">
                    名称：<input type="text" class="required"  name="channel[name]" /> &nbsp;&nbsp;
                    标题：<input type="text" class="required"  name="channel[title]" />
                      <input type="submit" name="submit]" value="增加" />
                 </form>
                </div>
     </div>
        
     <!--修改目录表单-->
     <div id="updateDiv" style="display:none">
        <form id="updateform"  method="post" action="/content_manage/update"> 
           <%= tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, 
                  :value => form_authenticity_token) %> 
           <%= hidden_field_tag "content[id]", @content.id %>
            <div class="style01">名称:<input type="text" class="required"  name="content[name]" value="<%= @content.name%>" /></div><p>
            <div class="style02">标题:<input type="text" class="required"  name="content[title]" value="<%= @content.title%>" /></div><p>
            <div class="style01">类型:<input type="text" class="required"  name="content[c_type]" value="<%= @content.c_type%>" /></div><p>
            <input type="hidden" class="required"  name="content[is_article]" value="no"/>
            <div class="style02">频道:<select class="input_style"  name="content[channel_id]">
                                 <% for ch in channel=Channel.find(:all) %>
                                          <option value="<%=ch.id%>" ><%=ch.name%></option>
                                  <% end %>      
                                           </select>
            </div><p>
           <input type="submit" value="保存" class="cButton" style="margin-left: 150px"/>
        </form> 
    </div>    
  <!--添加表单-->
    <div id="artDiv" style="display:none">
              <% form_for(:flash, :url => {:action=>'create_flash'}, :html => { :multipart => true }) do |f| -%> <p> 
                   <label for="picture">增加flash:</label> 
                                   <div class="style02">名称:<input class="required"   type="text" name="name" ></input></div><br/>
                    <div class="style03">描述:<textarea class="textarea_style"  type="text" name="description" ></textarea></div><br />
                     <input type="hidden" name="content_id" value="<%=@content.id%>" ></input>
                     <div> 上传Flash:<%= f.file_field :uploaded_data %></div><br /> 
                 <%= submit_tag '添加' , :class=>"Button" %> </p> 
              <% end -%>
    <p>
 </div>
  <!--添加子目录表单-->
     <div id="dirDiv" style="display:none">
        <form id="dirform"  method="post" action="/content_manage/create_subdir">
             <%= tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, 
                 :value => form_authenticity_token) %> 
              <div class="style02">名称:<input class="required"  type="text" name="content[name]"></input></div><p>
              <div class="style01">标题:<input class="required"  type="text" name="content[title]"></input></div><p>
              <div class="style02">类型:<input class="required"  type="text" name="content[c_type]"></input></div><p>
              <div class="style01">频道:<select class="required"   name="content[channel_id]">
                                 <% for ch in channel=Channel.find(:all) %>
                                          <option value="<%=ch.id%>"><%=ch.name%></option>
                                  <% end %>      
                                           </select></div><p>
               <input type="hidden" name="content[is_flash]" value="yes"/>
               <input type="hidden" name="content[is_music]" value="no"/>
               <input type="hidden" name="content[is_article]" value="null"/>
              <input type="hidden" name="content[parent_id]" value="<%=@content.id%>" />
             <input type="submit" value="保存" 
             class="cButton" style="margin-left: 150px"/>        
     </div>
